package edu.yctc.patterns.constant;

/**
 * @className ResultCode
 * @description 返回值常量
 * @author zyj
 * @date 2019年12月10日
 *
 */
public class ResultCode {

    /** 成功 */
    public static final int SUCCESS = 1;
    public static final String MSG_SUCCESS = "success";

    // 业务中细分的code 1000-1999
    /** 用户未登录 */
    public static final int USER_NOT_SIGN_IN = 1000;
    public static final String MSG_USER_NOT_SIGN_IN = "user not sign in";

    /** 登陆错误 */
    public static final int SIGN_IN_ERROR = 1001;
    public static final String MSG_SIGN_IN_ERROR = "sign in error";

    /** 无用户错误 */
    public static final int NO_SUCH_USER = 1002;
    public static final String MSG_NO_SUCH_USER = "no such user";

    /** 密码错误 */
    public static final int PASSWORD_ERROR = 1003;
    public static final String MSG_PASSWORD_ERROR = "password error";

    /** 账号或密码错误 */
    public static final int INCORRECT_NUMBER_OR_PASSWORD = 1004;
    public static final String MSG_INCORRECT_NUMBER_OR_PASSWORD = "incorrect number of password";

    /** 无此博客 */
    public static final int NO_SUCH_BLOG = 1005;
    public static final String MSG_NO_SUCH_BLOG = "no such blog";

    /** 键冲突 */
    public static final int CONFLICT_MAP_KEY = 1006;
    public static final String MSG_CONFLICT_MAP_KEY = "conflict map key";

    // 用于测试
    /** 缓存获取 */
    public static final int FROM_CACHE = 1007;
    public static final String MSG_FROM_CACHE = "from cache";

    /** 数据库获取 */
    public static final int FROM_DB = 1008;
    public static final String MSG_FROM_DB = "from db";

    // 一些可能共性的异常code 9000~9999
    /** 接口已下线 */
    public static final int INTERFACE_OFFLINE = 9000;
    public static final String MSG_INTERFACE_OFFLINE = "interface is offline";

    /** 数据库错误 */
    public static final int DB_ERROR = 9001;
    public static final String MSG_DB_ERROR = "db error";

    /** 参数非法 */
    public static final int PARAMETER_INVALID = 9002;
    public static final String MSG_PARAMETER_INVALID = "parameter invalid";

    /** 非法访问 */
    public static final int ILLEGAL_ACCESS = 9003;
    public static final String MSG_ILLEGAL_ACCESS = "illegal access";

    /** 外键约束 */
    public static final int FOREIGN_KEY_CONSTRAINT = 9004;
    public static final String MSG_FOREIGN_KEY_CONSTRAINT = "foreign key constraint";

    /** 系统错误 */
    public static final int ERROR_SYSTEM_EXCEPTION = 9999;
    public static final String MSG_ERROR_SYSTEM_EXCEPTION = "system error";

}
